<template>
  <div>
    <div style="display: flex; height: 60px; line-height: 60px; border-bottom: 1px solid #eee;background-color: #035549FF" >
      <div style=" display: flex; padding-left: 5px;background-color: #035549FF">
        <div style="width: 60px">
          <img src="../../assets/logo1.jpg" alt="" style="width: 60px;height: 60px; position: relative;float: left; right: 0">
        </div>
        <div style="width: 250px;color: #ffd04b">余姚医疗塑料展销系统卖家中心</div>
<!--        <div style="flex: 1;">-->
<!--          <el-menu :default-active="'1'" class="el-menu-demo" mode="horizontal" router-->
<!--                   background-color="#545c64"-->
<!--                   text-color="#fff"-->
<!--                   active-text-color="#ffd04b">-->
<!--            <el-menu-item index="/front/home">首页</el-menu-item>-->
<!--          </el-menu>-->
<!--        </div>-->
      </div>
      <div style="flex: 1">
        <div style="text-align: right; padding-right: 40px;">
          <el-button type="warning" icon="el-icon-user-solid" circle @click="$router.push('/business/person')"></el-button>
          <el-button type="warning" icon="el-icon-alarm-clock" circle @click="$router.push('/business/calendar')"></el-button>
          <el-button type="warning" round  @click="$router.push('/login')">退出</el-button>
        </div>
      </div>
    </div>

  <div style="display: flex">
<!--    侧边栏-->
    <div style="display: flex">
      <el-menu
          style="width: 200px; min-height: calc(100vh - 50px);"
          :default-active="path"
          router
          active-text-color="#ffd04b"
          background-color="#035549FF"
          text-color="#fff"
      >
        <el-menu-item index="/business/home"> <i class="el-icon-user-solid"></i>我的名片</el-menu-item>
        <el-menu-item index="/business/busnews"><i class="el-icon-document"></i>企业新闻管理</el-menu-item>
        <el-menu-item index="/business/busgoods"><i class="el-icon-s-shop"></i>产品管理</el-menu-item>
        <el-menu-item index="/business/place"><i class="el-icon-office-building"></i>场地申请</el-menu-item>
        <el-menu-item index="/business/order"><i class="el-icon-files"></i>订单管理</el-menu-item>
        <el-submenu index="1">
          <template #title > <i class="el-icon-goods"></i>采购报价</template>
          <el-menu-item index="/business/procurement"><i class="el-icon-s-marketing"></i>报价管理</el-menu-item>
          <el-menu-item index="/business/sprocurement"><i class="el-icon-document-checked"></i>成功记录</el-menu-item>
        </el-submenu>
        <el-menu-item index="/business/rolling"><i class="el-icon-thumb"></i>索样请求</el-menu-item>
        <el-menu-item index="/business/enquiry"><i class="el-icon-chat-dot-square"></i>询价请求</el-menu-item>
<!--        <el-menu-item index="/business/calendar"><i class="el-icon-alarm-clock"></i>日历</el-menu-item>-->
      </el-menu>
    </div>
    <div style="width: 1000px; margin: 0 auto;flex: 1">
      <router-view></router-view>
    </div>
  </div>
  </div>
</template>

<script>
import request from "@/utils/request";
export default {
  name: "Front",
  data() {
    return {
      user: {},
      path: this.$route.path   // 设置默认高亮的菜单
    }
  },
  created() {
    let userStr = sessionStorage.getItem("user") || "{}"
    this.user = JSON.parse(userStr)

    // 请求服务端，确认当前登录用户的 合法信息
    request.get("/user/" + this.user.id).then(res => {
      if (res.code === '0') {
        this.user = res.data
      }
    })
  },
  methods: {
    logout() {
      this.$store.commit("logout")
      this.$message.success("退出成功")
    }
  }
}
</script>

<style scoped>

</style>